package com.example.springmybatis.service;

import com.example.springmybatis.entity.Admin;
import com.example.springmybatis.mapper.Adminmapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class Adminserver {
    @Resource
    private Adminmapper adminmapper;

    public Admin login(Admin admin){
       Admin admin1= adminmapper.selectUsername(admin.getUsername());
       return admin1;
    }
    public Admin register(Admin admin){
        Admin admin1=adminmapper.register(admin.getUsername(),admin.getPassword());
        return admin1;
    }
    public String upimg(String file,String id){
        file="admin_img/"+file;
        System.out.println("id = " + id);
        String res=adminmapper.upimg(file,id);
        return res;
    }
}
